﻿using System;

class GradeCalculator
{
    static void Main(string[] args)
    {
        Console.WriteLine("学生成绩等级评定系统");
        Console.WriteLine("====================");

        while (true)
        {
            Console.Write("\n请输入学生成绩（0-100之间，输入-1退出）：");

            if (double.TryParse(Console.ReadLine(), out double score))
            {
                if (score == -1)
                {
                    Console.WriteLine("程序结束！");
                    break;
                }

                if (score < 0 || score > 100)
                {
                    Console.WriteLine("错误：成绩必须在0-100之间！");
                    continue;
                }

                char grade = GetGrade(score);
                Console.WriteLine($"成绩 {score} 分的等级为：{grade}");
                Console.WriteLine(GetGradeDescription(grade));
            }
            else
            {
                Console.WriteLine("请输入有效的数字！");
            }
        }
    }

   
    static char GetGrade(double score)
    {
        if (score >= 90)
        {
            return 'A';
        }
        else if (score >= 60) // 60-89分
        {
            return 'B';
        }
        else // 60分以下
        {
            return 'C';
        }
    }

    
    static string GetGradeDescription(char grade)
    {
        return grade switch
        {
            'A' => "优秀！继续保持！",
            'B' => "良好！还有提升空间。",
            'C' => "需要加油！要多加努力。",
            _ => "未知等级"
        };
    }
}